package com.accesshollywood.grfxOrdering.orderTreeSpecial;

import java.awt.Component;

import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.tree.TreeCellEditor;

import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.AbstractButtonPlusModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.ButtonAndListModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.models.ButtonAndStringModel;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.nodes.ApprTreeNode;
import com.accesshollywood.grfxOrdering.orderTreeSpecial.nodes.ItemTreeNode;
import com.accesshollywood.indexables.GrfxOrder;
import com.accesshollywood.trace.Trace;

public class TreeAsTablesEditorMaster{/* extends AbstractCellEditor implements TreeCellEditor {
	TreeAsTablesRendererMaster renderer = new TreeAsTablesRendererMaster();
	JTree tree;

	public TreeAsTablesEditorMaster(JTree tree) {
		this.tree = tree;
		//Trace.info("editor");
	}

	@Override
	public Object getCellEditorValue() {
		//Trace.info("getCellEditorValue");
		return null;
	}
	
	@Override
	public Component getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) {
		JTree currTree = tree;
		TreeAsTablesRendererMaster editor = (TreeAsTablesRendererMaster) renderer.getTreeCellRendererComponent(tree, value, true, expanded, leaf, row, true);

		if (leaf) {
			if (value instanceof ApprTreeNode) {
				ApprTreeNode node = (ApprTreeNode) value;
				node.subPanel.addResearchListener(node.new ApprItemListener(ApprPanel.flagResearch));
				node.subPanel.addPhotoEditListener(node.new ApprItemListener(ApprPanel.flagPhotoEdit));
				node.subPanel.addFootageListener(node.new ApprItemListener(ApprPanel.flagFootage));
				node.subPanel.addLegalListener(node.new ApprItemListener(ApprPanel.flagLegal));
			}else if(value instanceof ItemTreeNode){
				ItemTreeNode node = (ItemTreeNode) value;
				for(int i = 0; i < node.subPanel.allButtons.size(); i++){
					AbstractButtonPlusModel currButton = node.subPanel.allButtons.get(i);
					Object[] selection = currButton.getSelectedObjects();
					if(selection == null || selection.length == 0){
						selection = currButton.listing.toArray();
					}
					if(currButton instanceof ButtonAndStringModel){
						//node.subPanel.addButtonListener(currButton, currButton.new CopyToClipboardActionListener(selection));
					}else{
						if(((ButtonAndListModel)currButton).listing.isText()){
							//node.subPanel.addButtonListener(currButton, currButton.new CopyToClipboardActionListener(selection));
						}else{
							//node.subPanel.addButtonListener(currButton, currButton.new OpenFolderActionListener());
						}
						
					}
				}
			}
		}  else if (value instanceof GrfxOrder) {
			SummaryPanel summaryPanel = editor.summaryTreeNode.subPanel;
			final JTable mainTable = summaryPanel.mainTable;
			SummaryPanel.SummaryTableEditor summaryTableEditor = summaryPanel.new SummaryTableEditor();

			return editor;
		}

		//Trace.info("getTreeCellEditorComponent");
		return editor;
	}
	*/
}
